﻿<%@ Page Language="C#" Debug="true" ValidateRequest="false" EnableEventValidation="False" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="InlineEditBox" Namespace="Sys.Web.Ajax" TagPrefix="ajax" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        body {
            font-family:Verdana, Arial, Tahoma;
            font-size: 12px;
        }
        
        .firstname {
            padding:7px;
            display:block;
        }
        
        .lastname {
            padding:7px;
            display:block;
        }
        
        .ieb {
            padding:7px;
        }
        
        .hover {
            padding:4px;
            border:3px dashed darkblue;
            background:lightblue;
        }
        
        .textbox {
        }
        
    </style>
    <script language="javascript" type="text/javascript">
        function ieUpdate(result, referrer)
        {
            alert("Inline Edit Blur Callback Called\n--------------------------------------\nNew Text: " + result + "\nCame From: " + referrer);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
        <asp:Label ID="postback" runat="Server" Visible="False"></asp:Label>
        <asp:Panel ID="pnlGetText" runat="Server" DefaultButton="btnGetText">
            <h3>InlineEdit Demo v0.0.7.0</h3>
            <hr />
            <table width="100%">
                <tr style="height:25px">
                    <td style="width:100px; vertical-align:top; text-align:right; font-weight:bold; margin-right:5px;">First Name:</td>
                    <td style="vertical-align:top">
                    <ajax:InlineEditBox
                        ID="ieFirstName"
                        runat="Server" 
                        Text="Property Assigned Text" 
                        DefaultBlankText="(Enter Text)" 
                        LabelCssClass="firstname" 
                        LabelHoverCssClass="hover" 
                        CssClass="textbox" 
                        ResizeTextboxHeight="False" 
                        ResizeTextboxWidth="false" 
                        CallBackOnBlur="true"
                        CallBackFunction="ieUpdate"
                    />
                    </td>
                </tr>
                <tr style="height:25px">
                    <td style="width:100px; vertical-align:top; text-align:right; font-weight:bold; margin-right:5px;">Last Name:</td>
                    <td style="vertical-align:top">
                    <ajax:InlineEditBox
                        ID="ieLastName" 
                        runat="Server"
                        DefaultBlankText="(Enter Text)" 
                        LabelCssClass="lastname" 
                        LabelHoverCssClass="hover" 
                        CssClass="textbox" 
                        ResizeTextboxHeight="True" 
                        ResizeTextboxWidth="False"
                        CallBackOnBlur="true"
                        CallBackFunction="ieUpdate"
                        CallBackIfIdentical="true"
                        MaxLength="35"
                        TextMode="multiLine"
                        ClickMode="doubleClick"
                        Width="300"
                        height="200"
                        ClientIDSuffix="test"
                    />
                    </td>
                </tr>
                <tr><td></td><td></td></tr>
                <tr>
                    <td></td>
                    <td>
                        <asp:Button ID="btnGetText" OnClick="click" runat="Server" Text="Get Text!" />&nbsp;&nbsp;
                        <asp:Button ID="btnToggleModes" OnClick="toggle" runat="Server" Text="Toggle Mode" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2"></td>
                </tr>
                <tr><td colspan="2">Now you can use a repeater control:</td></tr>
                <asp:Repeater ID="rpt" runat="Server">
                    <ItemTemplate>
                        <tr style="height:25px">
                            <td style="width:100px; vertical-align:top; text-align:right; font-weight:bold; margin-right:5px;"><asp:Label Text='<%#DataBinder.Eval(Container.DataItem,"index")%>' runat="server"></asp:Label></td>
                            <td style="vertical-align:top">
                            <ajax:InlineEditBox
                                ID="ieRepeater"
                                runat="Server" 
                                Text='<%# "Textbox " + DataBinder.Eval(Container.DataItem,"index")%>'
                                LabelCssClass="firstname" 
                                LabelHoverCssClass="hover" 
                                CssClass="textbox" 
                                ResizeTextboxHeight="False" 
                                ResizeTextboxWidth="false" 
                                CallBackOnBlur="true"
                                CallBackFunction="ieUpdate"
                                Mode="AdminMode"
                                ClientIDSuffix='<%# "box:" + DataBinder.Eval(Container.DataItem,"index")%>'
                            />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
                <tr>
                    <td colspan="2"><hr /></td>
                </tr>
                <tr><td colspan="2">Update Panel Test:</td></tr>
                <tr>
                    <td colspan="2">
                        <asp:Panel ID="pnlUpdatecontainer" runat="Server" style="line-height:1.4em; border:1px solid blue;padding:10px">
                            <asp:UpdatePanel ID="pnlUpdate" runat="Server">
                                <ContentTemplate>
                                    <ajax:InlineEditBox ID="lblTime" runat="Server" LabelCssClass="ieb" LabelHoverCssClass="hover" CssClass="textbox"></ajax:InlineEditBox>
                                    <asp:Button ID="btnTime" runat="Server" Text="Get Time" OnClick="time" />
                                    <hr />
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </form>
</body>
</html>
